Add 'created_by' option to OSM writer.
authorrobertl <robertl>
Sat, 16 Aug 2008 01:55:34 +0000 (01:55 +0000)
committerrobertl <robertl>
Sat, 16 Aug 2008 01:55:34 +0000 (01:55 +0000)
osm.c

diff --git a/osm.c b/osm.c
index 283d321eeb2ac3705ba3d67560c3d9ab0a9a55a6..0835d3bd443c8ab252ff9e6e504f4404ec099b99 100644 (file)
--- a/osm.c
+++ b/osm.c
 #include "avltree.h"
 #include "xmlgeneric.h"
 
-static char *opt_tag, *opt_tagnd;
+static char *opt_tag, *opt_tagnd, *created_by;
 
 static arglist_t osm_args[] = 
 {
        { "tag", &opt_tag,      "Write additional way tag key/value pairs", NULL, ARGTYPE_STRING, ARG_NOMINMAX },
        { "tagnd", &opt_tagnd,  "Write additional node tag key/value pairs", NULL, ARGTYPE_STRING, ARG_NOMINMAX },
+       { "created_by", &created_by, "Use this value as custom created_by value","GPSBabel", ARGTYPE_STRING, ARG_NOMINMAX },
        ARG_TERMINATOR
 };
 
@@ -849,11 +850,14 @@ osm_waypt_disp(const waypoint *wpt)
                                break;
                }
                
-               gbfprintf(fout, "    <tag k='created_by' v='GPSBabel");
-               if (gpsbabel_time != 0)
-                       gbfprintf(fout, "-%s", gpsbabel_version);
-               gbfprintf(fout, "'/>\n");
-
+               if (strlen(created_by) !=0) {
+                       gbfprintf(fout, "    <tag k='created_by' v='%s",created_by);
+                       if (gpsbabel_time != 0)
+                               if (strcmp("GPSBabel",created_by)==0)
+                                       gbfprintf(fout, "-%s", gpsbabel_version);
+                       gbfprintf(fout, "'/>\n");
+               }
+               
                osm_write_tag("name", wpt->shortname);
                osm_write_tag("note", (wpt->notes) ? wpt->notes : wpt->description);
                if (wpt->icon_descr)
@@ -901,10 +905,13 @@ osm_rte_disp_trail(const route_head *rte)
 {
        if (skip_rte) return;
 
-       gbfprintf(fout, "    <tag k='created_by' v='GPSBabel");
-       if (gpsbabel_time != 0)
-               gbfprintf(fout, "-%s", gpsbabel_version);
-       gbfprintf(fout, "'/>\n");
+       if (strlen(created_by) !=0) {
+               gbfprintf(fout, "    <tag k='created_by' v='%s",created_by);
+               if (gpsbabel_time != 0)
+                       if (strcmp("GPSBabel",created_by)==0)
+                               gbfprintf(fout, "-%s", gpsbabel_version);
+               gbfprintf(fout, "'/>\n");
+       }
 
        osm_write_tag("name", rte->rte_name);
        osm_write_tag("note", rte->rte_desc);